package org.jks.model;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "article")
public class Article {
	@Id
	@GeneratedValue(generator = "increment")
	@GenericGenerator(name = "increment", strategy = "increment")
	@Column(name = "id")
	private long id;
	@Column(name = "title", length = 64, nullable = false)
	private String title;
	@Lob
	@Column(name = "brief", nullable = false)
	private String brief;
	@Lob
	@Basic(fetch=FetchType.LAZY) 
	@Column(name = "content", nullable = false)
	private String content;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "createtime", length = 10, nullable = false)
	private Date createtime;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modifytime", length = 10, nullable = false)
	private Date modifytime;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "category_id", updatable = false, nullable = false, referencedColumnName = "id")
	private Category category;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getBrief() {
		return brief;
	}

	public void setBrief(String brief) {
		this.brief = brief;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	public Date getModifytime() {
		return modifytime;
	}

	public void setModifytime(Date modifytime) {
		this.modifytime = modifytime;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}
	
}
